//引入请求的工具
import ajax from "@/utils/request.js";

//获取评论或者回复
const comments = obj => {
  return ajax({
    url: "/app/v1_0/comments",
    method: "GET",
    params: { ...obj }
  });
};

//对评论进行点赞的接口
const addCommentLike = commentId => {
  return ajax({
    url: "/app/v1_0/comment/likings",
    method: "POST",
    data: {
      target: commentId
    }
  });
};

//取消对评论点赞的接口
const delCommentLike = commentId => {
  return ajax({
    url: `/app/v1_0/comment/likings/${commentId}`,
    method: "DELETE"
  });
};

//添加评论或评论回复的接口
const pushCom = obj => {
  return ajax({
    url: "/app/v1_0/comments",
    method: "POST",
    data: {
      ...obj
    }
  });
};

export { comments, addCommentLike, delCommentLike, pushCom };
